#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDate>
#include <QSqlDatabase>
#include "dailywidget.h"

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private slots:
    // File menu
    void on_actionSelectDatabase_triggered();
    void on_actionExportExcel2003XML_triggered();
    void on_actionExit_triggered();

    // Table menu
    void on_actionProducts_triggered();
    void on_actionComponents_triggered();
    void on_actionEdit_triggered();

    // Help menu
    void on_actionAbout_triggered();
    void on_actionAboutQt_triggered();

    // widgets
    void on_userComboBox_currentIndexChanged(int index);
    void on_todayButton_clicked();
    void on_prevButton_clicked();
    void on_nextButton_clicked();
    void on_fastRewindButton_clicked();
    void on_fastForwardButton_clicked();
    void on_zoomComboBox_currentIndexChanged(const QString&);

private:
    // database
    void setDatabase(const QString& dbFileName);
    void createTable();
    void createTableIfNeeded(const QStringList& tables, const QString& tableName);
    void createUserList();

    // date
    void setDate(const QDate& date);

    Ui::MainWindow *ui;
    QSqlDatabase db_;
    QString dbName_;
    int userID_;
    QDate date_;
};

#endif // MAINWINDOW_H
